<%-- 
    Document   : ListarSectores
    Created on : 29-oct-2011, 16:41:52
    Author     : Jose Luis
--%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<%@page import="java.sql.Connection"%>
<%@page import="docmanager.engine.DMController"%>
<%@page import="docmanager.business.objects.Sector"%>
<%@page import="java.util.*"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Sectores</title>
	</head>
	<body>
		<form action="DMController">
		
		       <%
			       String mensaje = (String) request.getAttribute("mensaje");
			       if (mensaje != null)
			           out.println(mensaje);
		       %>
		       
		       
			<table border=3>
				<tr bgcolor="#A0D0A0"> <td> ID </td> <td> Descripcion </td> <td>Borrar</td> </tr>
		           <%
		             List sectores = (List) request.getAttribute("sectores");
		             Iterator it = sectores.iterator();
		             while (it.hasNext())
		             {
		                 Sector sector = (Sector) it.next();
		                 String link = "<a href='DMController?op=ModificarSector1&id="+sector.getId()+"'>" + sector.getDescripcion() + "</a>";
		                 out.println("<TR> <TD>" + sector.getId() + "</td>" );
		                 out.println("<TD>" + link + "</td>");
		                 out.println("<td> <input type='checkbox' name=id value=" + sector.getId() + "> </td>");
		             }   out.println("</tr>");
		           %>
		          
			</table>
		
		<%
			String serverPath = DMController.getServerPath(request);
		%>                       
		           
			<script type="text/javascript">
				function execAgregarSector()
				{
				    document.location.href = "<%=serverPath%>/DMController?op=AgregarSector1"
				}
				
				// Agregar confirmacion para la eliminacion.
			</script>
		     
			<input type="button" value="Agregar Sector" name="agregarSector" onclick="execAgregarSector();" />   
			<input type="hidden" name="op" value="EliminarSectores">
			<input type="submit" value="Eliminar Sectores" name="eliminarSectores"> 
			

<script type="text/javascript">			
function execMenuPrincipal()
{
    document.location.href = "<%=serverPath%>/DMController?op=MenuPrincipal"
}

</script>
<input type="button" value="Menu Principal" name="menuPrincipal" onclick="execMenuPrincipal();">
			    
		</form>
	</body>
</html>
